﻿using System;
using System.Collections.Generic;
using System.Drawing.Printing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Common.Page
{
    public class PageList<TData> : PageData<TData, PageInfo>
    {
        public PageList()
        {

        }
        public PageList(IEnumerable<TData> source)
        {
            Data = source;
        }
        public PageList(IEnumerable<TData> source, PageInfo pageInfo)
        {
            PageInfo = pageInfo;
            Data = source;
        }
        public PageList(IEnumerable<TData> source, int pageIndex, int pageSize, int totalCount)
        {
            PageInfo = new PageInfo()
            {
                TotalCount = totalCount,
                PageSize = pageSize,
                PageIndex = pageIndex
            };
            Data = source;
        }
    }

    public abstract class PageData<TData, TPageInfo>
    {
        public IEnumerable<TData>? Data { get; set; }

        public TPageInfo PageInfo { get; set; }
    }

    public class PageInfo
    {
        public int PageIndex { get; set; }

        public int PageSize { get; set; }

        public int TotalCount { get; set; }
    }
}
